
export default {
  $tips(title,icon='none',duration=1000){
    return new Promise((reslove,reject)=>{
      uni.showToast({
        title,
        icon,
        duration,
        success:()=>{
          setTimeout(()=>{
            reslove(true)
          },duration)
        },
        fail:()=>{
          reject(false)
        }  
      })
    })
  },
  $alert(title,content=''){
    return new Promise((reslove,reject)=>{
      uni.showModal({
        title,
        content,
        success: function (res) {
          if (res.confirm) {
            reslove('true');
          } else if (res.cancel) {
            reject('false');
          }
        }
      })
    })
  },
  $load(title='加载中'){
    uni.showLoading({
      title
    });
  }
}